package com.mashibing.api.util;

import com.mashibing.api.vo.ResultVO;
import com.mashibing.common.exception.ApiException;

/**
 * @ClassName:ResultVOUtil
 * @author:[开发者名称]
 * @Description:[类的功能描述]
 * @Date:2025/9/13/21:16
 * @Version:1.0
 */
public class ResultVOUtil {
    public static ResultVO ok(){
        ResultVO resultVO = ResultVO.builder()
                .code(0)
                .msg("接口模块接收成功")
                .build();

        return resultVO;
    }

    public static ResultVO error( int code,String msg ) {
        ResultVO resultVO = ResultVO.builder()
                .code(code)
                .msg("错误信息:"+msg)
                .build();

        return resultVO;
    }
    public static ResultVO error(ApiException ex) {

        ResultVO resultVO = ResultVO.builder()
                .code(ex.getCode())
                .msg("错误信息:"+ex.getMessage())
                .build();
        return resultVO;
    }
}
